package com.woniuxy.hrp.service.Serviceimpl;

import com.woniuxy.hrp.entity.Admin;
import com.woniuxy.hrp.mapper.AdminMapper;
import com.woniuxy.hrp.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("adminService")
public class AdminServiceImp implements AdminService {
    @Autowired
    private AdminMapper adminMapper;
    @Override
    public Admin login(Admin admin) {
        if(adminMapper.getByAccount(admin.getAccount())!=null){
            Admin byAccountAndPassword = adminMapper.getByAccountAndPassword(admin.getPassword(), admin.getAccount());
            if(byAccountAndPassword!=null){
                return byAccountAndPassword;
            }else {
                return null;
            }
        }else {
            return null;
        }
    }
}
